﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using YAPL.Language.Compiler.CodeGen.ReflectionEmitGenerator.AstGen.Helpers;
using Ast = YAPL.Language.Ast;

namespace YAPL.Language.Compiler.CodeGen.ReflectionEmitGenerator.AstGen {
	public class ReVariableGenerator : ReExpressionGenerator {
		public ReVariableGenerator(ReCodeGenerator generator) : base(generator) {}
		public override void Generate(Ast.Expression expr) {
			var variableExpr = (Ast.VariableExpression)expr;
			var ilGen = Generator.Get<ILGenerator>(ReCodeGenerator.IL_GENERATOR_KEY);

			ilGen.EmitGetLocalVariableFromScope(variableExpr.Name);
		}
	}
}
